<template>
  <el-dialog
    class="room_rank"
    :model-value="modelValue"
    title="禁言名单"
    style="width: 324px; height: auto !important"
    draggable
    :modal="false"
    :append-to-body="true"
    show
    @update:model-value="handleClose"
  >
    <template #header="{ close, titleId, titleClass }">
      <div class="custom_header">
        <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
          <el-tab-pane label="实时排行" name="first"></el-tab-pane>
          <el-tab-pane label="省级PK赛" name="second"></el-tab-pane>
        </el-tabs>
      </div>
    </template>
    <div class="flex_out">
      <div v-if="activeName === 'first'" class="flex_inner">
        <div class="flex_date">
          <span>悦耳声优</span>
        </div>
        <div class="flex_date">
          <span>总收益：</span>
          <span>3.4k</span>
        </div>
      </div>
      <div v-else style="width: 100%">
        <div class="flex_inner">
          <div class="flex_date">
            <span>四川省</span>
            <span>S1赛季</span>
          </div>
          <div class="flex_date">
            <span>悦耳声优</span>
          </div>
          <div>
            <el-button type="text">比赛规则</el-button>
          </div>
        </div>
        <div class="flex_inner">
          <span>2025-01-01至2025-01-01</span>
        </div>
      </div>
      <el-scrollbar height="500px" style="width: 100%; margin: 10px 0 10px 0">
        <ul class="infinite-list">
          <li v-for="i in count" :key="i" class="infinite-list-item">
            <div class="li_item">
              <!-- {{ i }} -->
              <div
                style="
                  display: flex;
                  flex-direction: row;
                  justify-content: center;
                  align-items: center;
                "
              >
                <img v-if="i == 1" src="@/assets/live/king1.png" alt="" class="king_img" />
                <img v-else-if="i == 2" src="@/assets/live/king2.png" alt="" class="king_img" />
                <img v-else-if="i == 3" src="@/assets/live/king3.png" alt="" class="king_img" />
                <span v-else class="other_rank">{{ i }}</span>
                <img
                  style="
                    margin-left: 8px;
                    border-radius: 50%;
                    border-radius: 50%;
                    border: 2px solid #ffffff;
                  "
                  src="https://axure-file.lanhuapp.com/md5__862eb7a7eeb6b7490153498e634cb182.jpg"
                  alt=""
                  srcset=""
                />
                <div
                  style="
                    display: flex;
                    flex-direction: column;
                    margin-left: 8px;
                    align-items: flex-start;
                  "
                >
                  <span class="name_span">用户昵称</span>
                  <div>
                    <img
                      src="@/assets/live/chenghao.png"
                      style="width: 54px; height: 16px; margin-top: 5px"
                      alt=""
                      srcset=""
                    />
                  </div>
                </div>
              </div>
              <div>
                <span class="gift_count">3.4k</span>
              </div>
            </div>
          </li>
        </ul>
      </el-scrollbar>
      <div class="me_rank">
        <div class="li_item">
          <div
            style="display: flex; flex-direction: row; justify-content: center; align-items: center"
          >
            <span class="other_rank">99</span>
            <img
              style="margin-left: 8px"
              src="https://axure-file.lanhuapp.com/md5__862eb7a7eeb6b7490153498e634cb182.jpg"
              alt=""
              srcset=""
            />
            <div
              style="
                display: flex;
                flex-direction: column;
                margin-left: 8px;
                align-items: flex-start;
              "
            >
              <span class="name_span">用户昵称</span>
              <div>
                <span class="id_span">ID</span>
                <span class="id_span">132489489456</span>
              </div>
            </div>
          </div>
          <div>
            <span class="gift_count">3.4k</span>
          </div>
        </div>
      </div>
    </div>

    <!-- <template #footer>
      <el-button @click="handleClose">关闭</el-button>
    </template> -->
  </el-dialog>
</template>

<script setup>
import { defineProps, defineEmits } from "vue";

defineProps({
  modelValue: {
    // 接收父组件v-model传值
    type: Boolean,
    default: false,
  },
});
const activeName = ref("first");
const count = ref(10);
const emit = defineEmits(["update:modelValue"]);

// 关闭对话框时通知父组件更新状态
const handleClose = () => {
  emit("update:modelValue", false);
};
</script>
<style lang="scss">
.room_rank {
  padding: 0;
  background-color: #222222;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;

  .custom_header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: flex-start;
    align-items: center;
    color: #fff;
    line-height: 15px;

    .el-tabs {
      --el-tabs-header-height: 20px;

      .el-tabs__item {
        color: #fff;
      }

      .el-tabs__nav {
        height: 37px;
      }

      .el-tabs__nav-wrap:after {
        height: 0;
      }

      .el-tabs__active-bar {
        background-color: #fff;
      }

      .is-top {
      }
    }
  }

  .el-dialog__header {
    border: 1px solid rgba(216, 216, 216, 0.5);
    padding: 20px 20px 10px 20px;
    height: 56px;

    .el-dialog__headerbtn {
      height: 56px;
    }
  }

  .search_div {
    width: 100%;

    .el-input__wrapper {
      width: 177px;
      height: 26px;
      border-radius: 166px 166px 166px 166px;
      border: 1px solid #ffffff;
      background: #222;
      color: #fff;
    }
  }

  .flex_out {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: center;
    align-items: center;
    margin-top: 17px;
  }

  .flex_inner {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
  }

  .flex_date {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 400;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    font-style: normal;
    text-transform: none;
  }

  .infinite-list {
    height: 500px;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .infinite-list .infinite-list-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    margin: 30px 10px;

    .king_img {
      width: 32px;
      height: 23px;
    }
  }

  .other_rank {
    display: inline-block;
    width: 32px;
    height: 23px;
    height: 14px;
    font-weight: 400;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 14px;
    text-align: center;
    font-style: normal;
    text-transform: none;
  }

  .infinite-list .infinite-list-item + .list-item {
    margin-top: 10px;
    margin: 10px 6px;
  }

  .li_item {
    display: flex;
    align-items: stretch;
    justify-content: space-between !important;
    height: 3.125rem;
    /* background: var(--el-color-primary-light-9); */
    margin: 10px 0 10px 0 !important;
    align-content: center;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row;
    width: 100%;

    img {
      width: 48px;
      height: 48px;
    }

    .name_span {
      height: 17px;
      font-weight: 400;
      font-size: 14px;
      color: #ffffff;
      line-height: 16px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }

    .id_span {
      height: 17px;
      font-weight: 400;
      font-size: 12px;
      color: #ffffff;
      line-height: 16px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }

    .gift_count {
      margin-right: 20px;
      height: 17px;
      font-weight: 700;
      font-size: 16px;
      color: #ffffff;
      line-height: 16px;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
  }

  .me_rank {
    position: relative;
    width: calc(100% - 20px);
    font-weight: 400;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    font-style: normal;
    text-transform: none;
    margin-bottom: 10px;
    height: 68px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid;
    border-image: linear-gradient(
        270deg,
        rgba(255, 226.0000017285347, 89.00000229477882, 1),
        rgba(255, 167.00000524520874, 81.00000277161598, 1)
      )
      1 1;
    border-radius: 4px;
    background-clip: padding-box;
    border: 1px solid transparent;
    border-radius: 6px;
    background-image:
      linear-gradient(#393939, #393939),
      // 跟背景色保持一致，根据实际情况修改
      linear-gradient(
          270deg,
          rgba(255, 226.0000017285347, 89.00000229477882, 1),
          rgba(255, 167.00000524520874, 81.00000277161598, 1)
        ); // 取border-image的渐变色，按实际来修改
    background-origin: border-box;
    background-clip: content-box, border-box;
    img {
      border-radius: 50%;
      border: 2px solid #ffffff;
    }
  }

  .me_rank::after {
    content: "";
    position: absolute;
    border-radius: 4px;
    top: -1px;
    left: -1px;
    z-index: -1;
  }

  .el-dialog__footer {
    padding: 10px;
  }
}
</style>
